<?php

namespace App\Http\Controllers;
use DB;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
header("content-type:text/html;charset=utf-8");
class IndexController extends BaseController
{
    public function index(){
    	$re = DB::table('lunbo')->orderBy('order', 'asc')
    	->limit(3)
		->get();
    	//print_r($re);die;
    	$new = DB::table('car')->orderBy('c_id', 'desc')
    	->limit(12)
		->get();
		//print_r($new);die;
		$lian = DB::table('car')->where('b_id','=',2)
    	->limit(12)
		->get();
		//print_r($suv);die;
		$suv = DB::table('car')->where('m_id','=',1)
    	->limit(12)
		->get();
		//print_r($suv);die;
    	return view('index', ['re' => $re,'new'=>$new,'suv'=>$suv,'lian'=>$lian]);
    }
    //添加手机号卖车
    public function yan()
    {
    	$phone = $_POST['phone'];
    	$re = DB::table('user')->insert(
    	['u_phone' => $phone]);
    	if ($re) {
    		echo "添加成功";
    	}else{
    		echo "添加失败";
    	}

    }
}
